﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using WuYuHotel.WX_AccToken;
using System.Threading;
using WuYuHotel.Tools;



namespace WuYuHotel
{
    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            RegisterView();
            //微信全局变量参数
            //至专科技有限公司 服务号
            //Application.Add("mainURL", "http://15923051435.oicp.net/");
            //Application.Add("appid", "wx8261af4dcdbe9479");
            //Application.Add("secret", "94b327f0b2df0a7297ec53cf2adae212");


            //无隅的公众号
            Application.Add("appid", "wx8848f6a92e031532");
            Application.Add("secret", "5b3a901c69da2ba1dc4535deb93a0f9c");
            Application.Add("acc_Token", "");
            Application.Add("jsapi_ticket", "");
            Application.Add("noncestr", "");
            Application.Add("UNIXTime", "");
            Application.Add("api_ticket", "");




            WXAccToken accTokenThread = new WXAccToken();
            accTokenThread.context = HttpContext.Current;
            Thread WxThread = new Thread(new ThreadStart(accTokenThread.TokenThread));
            WxThread.IsBackground = true;
            WxThread.Start();

            ZhuZheAPI ZZAPI = new ZhuZheAPI();
            Thread ZZThread = new Thread(new ThreadStart(ZZAPI.SynZhuZheAPI_Thread));
            ZZThread.IsBackground = true;
            ZZThread.Start();

            //全局开始，设置并发数
            System.Net.ServicePointManager.DefaultConnectionLimit = 10;









        }

        protected void RegisterView()
        {
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new LayUIViewEngine());
        }
    }
}
